package com.changgou.page.listener;

import com.changgou.page.config.RaabitMqConfig;
import com.changgou.page.service.PageService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class PageListener {

    @Autowired
    private PageService pageService;

    @RabbitListener(queues = RaabitMqConfig.PAGE_CREATE_QUEUE)
    public void receiveMessage(String spuId){

        System.out.println("获取静态化页面商品id， 商品id为： "+spuId);

        //调用业务层完成静态页面生成
        pageService.generateHtml(Integer.parseInt(spuId));
    }
}
